﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="phan_quyen_quan_tri.ascx.cs" Inherits="Admin_Module_phan_quyen_quan_tri" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<fieldset>
    <legend>Danh Sách Quản trị</legend>
    <telerik:RadGrid ID="grd" AllowPaging="true" PageSize="20" runat="server" 
        AllowFilteringByColumn="True" Skin="WebBlue" GridLines="Horizontal"  AutoGenerateColumns="false" 
        onpageindexchanged="grd_PageIndexChanged">
        <MasterTableView NoDetailRecordsText="Không Có Dữ Liệu">
            <Columns>
                <telerik:GridTemplateColumn HeaderText="Tài Khoản" DataField="UserName">
                    <ItemTemplate>
                        <a href="/Admin/Form/User_Add.aspx?id=<%#DataBinder.Eval(Container.DataItem,"UserID")%>">
                            <%# Eval("UserName")%>
                        </a>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn HeaderText="Email" DataField="Email" AllowFiltering="true"></telerik:GridBoundColumn>
                <telerik:GridTemplateColumn HeaderText="Họ Tên" Visible="false" AllowFiltering="true">
                    <ItemTemplate>
                        <%# (Eval("FirstName").ToString() + Eval("LastName").ToString())%>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Giới Tính" DataField="Sex" AllowFiltering="true">
                    <ItemTemplate>
                        <%# ((Eval("Sex").ToString() == "1")?"Nam":"Nữ") %>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Ngày sinh" DataField="Birthday" AllowFiltering="true">
                    <ItemTemplate>
                        <%#
                            Utils.Format.FormatVietNameDate(Convert.ToDateTime(Eval("Birthday")))
                        %>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn Visible="false" HeaderText="Điện Thoại" DataField="Mobile" AllowFiltering="true"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn Visible="false" HeaderText="Địa Chỉ" DataField="Address" AllowFiltering="true"></telerik:GridBoundColumn>
                <telerik:GridTemplateColumn HeaderText="Ngày đăng ký" DataField="Birthday" AllowFiltering="true">
                    <ItemTemplate>
                        <%#
                            Utils.Format.FormatVietNameDate(Convert.ToDateTime(Eval("RegDate")))
                        %>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn Visible="false" HeaderText="Tên Công Ty" DataField="CompanyName" AllowFiltering="true"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn Visible="false" HeaderText="Địa Chỉ Công ty" DataField="CompanyAddress" AllowFiltering="true"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn Visible="false" HeaderText="Fax" DataField="Fax" AllowFiltering="true"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn Visible="false" HeaderText="Vị trí" DataField="Position" AllowFiltering="true"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn Visible="false" HeaderText="Công việc" DataField="Job" AllowFiltering="true"></telerik:GridBoundColumn>
                <telerik:GridCheckBoxColumn DataField="IsActive" Visible="false"></telerik:GridCheckBoxColumn>
                <telerik:GridTemplateColumn HeaderText="Kiểu Người Dùng" DataField="UserType" AllowFiltering="true">
                    <ItemTemplate>
                        <%#
                            GetUserType(Convert.ToByte(Eval("UserType")))                      
                        %>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Nhóm Quyền">
                    <ItemTemplate>
                        <asp:DropDownList runat="server" ID="ddl1" DataSource=<%# LoadRole() %> 
    DataTextField="RoleName" DataValueField="RoleID" ToolTip='<%# Eval("UserID") %>' AutoPostBack="true" OnLoad="ddl1_SetCurrentRole" onselectedindexchanged="ddl1_SelectedIndexChanged"><asp:ListItem Text="Chưa thuộc nhóm" Value="-1"></asp:ListItem></asp:DropDownList>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
</fieldset>